--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_x_komeiji_satori = General:new(extension, "hy_x_komeiji_satori", "x_k", 4, 4, General.Female)
    local mind_read = fk.CreateSkill {
        name = "mind_read",
    }
    mind_read:addEffect(fk.EventPhaseStart, {
        anim_type = "negative",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self) and player.phase == Player.Start and
                #table.filter(player.room:getOtherPlayers(player), function(t)
                    return table.any(t:getCardIds("h"), function(id)
                        return not HY.IsCardPublicized(Fk:getCardById(id))
                    end)
                end) > 0
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            event:setCostData(self, table.map(room:askToChoosePlayers(player, {
                targets = table.filter(room:getOtherPlayers(player), function(t)
                    return table.any(t:getCardIds("h"), function(id)
                        return not HY.IsCardPublicized(Fk:getCardById(id))
                    end)
                end),
                min_num = 1,
                max_num = 1,
                prompt = "mind_read_prompt",
                skill_name = mind_read.name,
            }), Util.IdMapper))
            return #event:getCostData(self) > 0
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local skillTarget = room:getPlayerById(event:getCostData(self)[1])
            HY.ReplaceHandCardToTempNew(player, skillTarget:getCardIds("h"))
            local cards = table.filter(skillTarget:getCardIds("h"), function(id)
                return not HY.IsCardPublicized(Fk:getCardById(id))
            end)
            local results = HY.AskForCard(player, 1, 1, false, mind_read.name, true, ".|.|.|.|.|.|" .. table.concat(cards, ","))
            HY.ReverseHandCardFromTempNew(player)
            HY.SetCardPublicize(room, results)
            HY.UpdatePublicizedCards(room)
        end,
    })
    local shy_rose = fk.CreateSkill {
        name = "shy_rose",
    }
    shy_rose:addEffect(fk.TargetConfirmed, {
        anim_type = "negative",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self) and data.to == player and data.from ~= player and data.card and #player:getCardIds("h") > 0 and player:usedSkillTimes(shy_rose.name, Player.HistoryTurn) < 1
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            local targets, cards = room:askToChooseCardsAndPlayers(player, {
                targets = room:getOtherPlayers(player),
                min_num = 1,
                max_num = 1,
                min_card_num = 1,
                max_card_num = 1,
                pattern = ".|.|.|hand",
                prompt = "shy_rose_prompt",
                skill_name = shy_rose.name
            })
            if #targets > 0 and #cards > 0 then
                event:setCostData(self, { targets[1].id, cards[1] })
                return true
            end
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local skillTarget = room:getPlayerById(event:getCostData(self)[1])
            local card = Fk:getCardById(event:getCostData(self)[2])
            room:moveCardTo(card, Card.PlayerHand, skillTarget, fk.ReasonGive, shy_rose.name, nil, true, player)
            HY.SetCardPublicize(room, card)
            local choices = { "shy_rose_prey::" .. skillTarget.id, "shy_rose_draw" }
            local cards = table.filter(skillTarget:getCardIds("h"), function(id)
                return not HY.IsCardPublicized(Fk:getCardById(id))
            end)
            if #cards == 0 then
                table.removeOne(choices, "shy_rose_prey::" .. skillTarget.id)
            end
            local result
            if #choices == 1 then
                result = choices[1]
            elseif #choices > 1 then
                result = room:askToChoice(player, {
                    choices = choices,
                    skill_name = shy_rose.name,
                    prompt = "shy_rose_prompt_choose",
                    all_choices = { "shy_rose_prey::" .. skillTarget.id, "shy_rose_draw" }
                })
            end
            if result == "shy_rose_prey::" .. skillTarget.id then
                room:obtainCard(player, table.random(cards, 1), nil, fk.ReasonPrey, player, shy_rose.name)
            elseif result == "shy_rose_draw" then
                room:drawCards(player, 1, shy_rose.name)
            end
            HY.UpdatePublicizedCards(room)
        end,
    })
    local mind_control = fk.CreateSkill {
        name = "mind_control",
    }
    mind_control:addEffect("prohibit", {
        is_prohibited = function(self, from, to, card)
            return to:hasSkill(self) and from ~= to and HY.IsCardPublicized(card)
        end,
        prohibit_use = function(self, player, card)
            return Fk:currentRoom().current:hasSkill(self) and player ~= Fk:currentRoom().current and HY.IsCardPublicized(card)
        end
    })
    extension:loadSkillSkels { mind_read, shy_rose, mind_control }
    hy_x_komeiji_satori:addSkill("mind_read")
    hy_x_komeiji_satori:addSkill("shy_rose")
    hy_x_komeiji_satori:addSkill("mind_control")
    Fk:loadTranslationTable {
        ["hy_x_komeiji_satori"] = "古明地觉",
        ["#hy_x_komeiji_satori"] = "煤气灯幽灵",
        ["illustrator:hy_x_komeiji_satori"] = "いちのせ",
        ["designer:hy_x_komeiji_satori"] = "黑曜人形",
        ["cv:hy_x_komeiji_satori"] = "",

        ["mind_read"] = "意读",
        [":mind_read"] = "准备阶段，你可以观看一名有暗置手牌的其他角色的手牌，然后你可以<a href='hy_card_publicize'>明置</a>其中一张牌。",
        ["mind_read_prompt"] = "意读：你可以观看一名角色的手牌",

        ["shy_rose"] = "厌影",
        [":shy_rose"] = "每回合限一次，在你成为其他角色使用牌的目标后，你可以交给一名角色一张手牌并<a href='hy_card_publicize'>明置</a>此牌，然后你选择一项：1.随机获得其一张暗置的手牌；2.摸一张牌。",
        ["@shy_rose"] = "厌影",
        ["shy_rose_prompt"] = "厌影：你可以交给一名角色一张手牌",
        ["shy_rose_prompt_choose"] = "厌影：你须选择一项",
        ["shy_rose_prey"] = "获得%dest手牌",
        ["shy_rose_draw"] = "摸一张牌",

        ["mind_control"] = "心控",
        [":mind_control"] = "其他角色无法对你使用<a href='hy_card_publicize'>明置</a>的手牌且无法于你的回合内使用<a href='hy_card_publicize'>明置</a>的手牌。",
    }
end
